﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QianBuo.Lottery.Web.Models.Surrogate.TeamReportModel>" %>
<%@ Import Namespace="Code.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	团队报表
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <% Html.DisableClientValidation(); %>
        <% Html.BeginForm(new { id = "teamreportform" }, new { ReturnUrl = Request["ReturnUrl"], act = Request["act"], cont = Request["cont"], arst = Request["arst"] }); %>
        <table class="table" width="100%">
            <tr class="th">
                <th colspan="5" align="left">
                    搜索条件(只能查询有账变用户)
                </th>
            </tr>
            <tr>
                <td align="center">
                    <label for="Lottery">游戏:</label>
                    <%=Html.DropDownListFor(p =>Model.Lottery, Model.Lotterys) %>
                </td>
                <td>
                    <label for="Search.LoginName">用户:</label>
                    <%=Html.TextBoxFor(p=>p.Search.LoginName,new{@class="text80"}) %>
                </td>
                <td>
                    <label id="lblStartTime" for="Search_StartTime">时间:</label>
                    <input type="text" class="text120" readonly="readonly" id="Search_StartTime" name="Search.StartTime" onclick="WdatePicker({dateFmt:'yyyy-M-d H:mm:00'})" value='<%=Model.Search.StartTime.ToString("G") %>' />
                </td>
                <td>
                    <label id="lblEndTime" for="Search_EndTime">至:</label>
                    <input type="text" class="text120" readonly="readonly" id="Search_EndTime" name="Search.EndTime" onclick="WdatePicker({dateFmt:'yyyy-M-d H:mm:00'})" value='<%=Model.Search.EndTime.ToString("G") %>' />
                </td>
                <td>
                    <input type="submit" value="查找" />
                </td>
            </tr>
        </table>
        <%=Html.HiddenFor(p=>p.PageSize) %>
        <% Html.EndForm(); %>
        <p />
        <% var uid = Session["Login_Uid"] as Guid?; %>
        <% var menu = Url.Action("TeamReport", Url.Route(new { Model.Lottery, Model.Uid, Model.Search, Model.Page, Model.PageSize })); %>
        <table class="table" width="100%">
            <% if (Model.Path != null&& Model.Path.Any()) %>
            <% { %>
            <tr><td align="left" colspan="11">
                <%=Html.ActionLink(Model.Path.First().Propertie1, "TeamReport", Url.Route(new { Model.Lottery, Search = new { StartTime = Model.Search.StartTime, EndTime = Model.Search.EndTime } }), Url.Route(new { @class = "a_blue" }))%>
                <% foreach (var item in Model.Path.Skip(1)) %>
                <% { %>
                >>&nbsp;&nbsp;<%=item.Propertie2 == ViewData["CurrentCmd"] as Guid? ? MvcHtmlString.Create(item.Propertie1) : Html.ActionLink(item.Propertie1, "TeamReport", Url.Route(new { Uid = item.Propertie2.ToString("N"), Model.Lottery, Search = new { StartTime = Model.Search.StartTime, EndTime = Model.Search.EndTime } }), Url.Route(new { @class = "a_blue" }))%>
                <% } %>
            </td></tr>
             <% } %>
            <tr class="th">
                <th>用户</th><th>类型</th><th>充值</th><th>提款</th><th>购彩</th><th>返点</th><th>下级返点</th><th>中奖</th><th>下级返奖</th><th>盈利</th><th>操作</th>
            </tr>
            <% if (Model.SelfReport != null) %>
            <% { %>
            <tr>
                <td><%=Model.SelfReport.LoginName%></td>
                <td>自己</td>
                <td align="right"><%=Model.SelfReport.AddMoney.ToString("F")%></td>
                <td align="right"><%=Model.SelfReport.TackMoney.ToString("F")%></td>
                <td align="right"><%=Model.SelfReport.PlayMoney.ToString("F")%></td>
                <td align="right"><%=Model.SelfReport.BackMoney.ToString("F")%></td>
                <td align="right"><%=Model.SelfReport.BackMoney_Child.ToString("F")%></td>
                <td align="right"><%=Model.SelfReport.WinMoney.ToString("F")%></td>
                <td align="right"><%=Model.SelfReport.WinMoney_Child.ToString("F")%></td>
                <td align="right">
                    <%=(Model.SelfReport.BackMoney + Model.SelfReport.BackMoney_Child + Model.SelfReport.WinMoney + Model.SelfReport.WinMoney_Child - Model.SelfReport.PlayMoney).Value.ToString("F")%></td>
                <td><%=Model.SelfReport.UserID == uid ? MvcHtmlString.Empty : Html.ActionLink("详情", "AccountDetail", Url.Route(new { Serch = new { LoginName = Model.SelfReport.LoginName, StartTime = Model.Search.StartTime.ToString("d"), EndTime = Model.Search.EndTime.ToString("d") }, ReturnUrl = menu, act = "TeamReport" }), Url.Route(new { @class = "a_blue" }))%></td>
            </tr>
            <% } %>
            <% if (Model.Report != null && Model.Report.Any()) %>
            <% { %>
            <% foreach (var item in Model.Report) %>
            <% { %>
            <tr>
                <td><%=item.UserType == (int)UserType.Surrogate ? Html.ActionLink(item.LoginName, "TeamReport", Url.Route(new { Uid = item.UserID.ToString("N"), Model.Lottery, Search = new { StartTime = Model.Search.StartTime, EndTime = Model.Search.EndTime } }), Url.Route(new { @class = "a_blue" })) : MvcHtmlString.Create(item.LoginName)%></td>
                <td><%=((UserType)item.UserType).GetName() %></td>
                <td align="right"><%=item.AddMoney.ToString("F")%></td>
                <td align="right"><%=item.TackMoney.ToString("F")%></td>
                <td align="right"><%=item.PlayMoney.ToString("F")%></td>
                <td align="right"><%=item.BackMoney.ToString("F")%></td>
                <td align="right"><%=item.BackMoney_Child.ToString("F")%></td>
                <td align="right"><%=item.WinMoney.ToString("F")%></td>
                <td align="right"><%=item.WinMoney_Child.ToString("F")%></td>
                <td align="right">
                    <%=(item.BackMoney + item.BackMoney_Child + item.WinMoney + item.WinMoney_Child - item.PlayMoney).Value.ToString("F")%></td>
                <td><%=Html.ActionLink("详情", "AccountDetail", Url.Route(new { Serch = new { LoginName = item.LoginName, StartTime = Model.Search.StartTime.ToString("d"), EndTime = Model.Search.EndTime.ToString("d") }, ReturnUrl = menu, act = "TeamReport" }), Url.Route(new { @class = "a_blue" }))%></td>
            </tr>
            <% } %>
            <% } %>
            <% if (Model.SumReport != null) %>
            <% { %>
            <tr>
                <td>总计</td>
                <td></td>
                <td align="right"><%=Model.SumReport.AddMoney.ToString("F")%></td>
                <td align="right"><%=Model.SumReport.TackMoney.ToString("F")%></td>
                <td align="right"><%=Model.SumReport.PlayMoney.ToString("F")%></td>
                <td align="right"><%=Model.SumReport.BackMoney.ToString("F")%></td>
                <td align="right"><%=Model.SumReport.BackMoney_Child.ToString("F")%></td>
                <td align="right"><%=Model.SumReport.WinMoney.ToString("F")%></td>
                <td align="right"><%=Model.SumReport.WinMoney_Child.ToString("F")%></td>
                <td align="right">
                    <%=(Model.SumReport.BackMoney + Model.SumReport.BackMoney_Child + Model.SumReport.WinMoney + Model.SumReport.WinMoney_Child - Model.SumReport.PlayMoney).Value.ToString("F")%></td>
                <td></td>
            </tr>
            <% } %>
            <% if (Model.SumCount > Model.PageSize) %>
            <% { %>
            <tr><td colspan="11" align="right"><%=Html.Pager(Model.Page ?? 1, Model.PageSize ?? 10, Model.SumCount, "Page", Url.Route(new { Model.Lottery, Uid = Model.Uid.ToString("N"), Model.Search }), "PageSize")%></td></tr>
            <% } %>
        </table>
        </div>
        <div id="sssss"></div>
</asp:Content>
